package com.main.organizationandplatformmanagement.interfaces.facade;

import com.main.common.base.resp.RespBody;
import com.main.organizationandplatformmanagement.application.service.OrganizationService;
import com.main.organizationandplatformmanagement.domain.organization.entity.Organization;
import com.main.organizationandplatformmanagement.domain.organization.entity.OrganizationModel;
import com.main.organizationandplatformmanagement.domain.organization.entity.OrganizationModelAtomType;
import com.main.organizationandplatformmanagement.domain.organization.entity.OrganizationModelAtoms;
import com.main.organizationandplatformmanagement.interfaces.dto.AddOrganizationDTO;
import com.main.organizationandplatformmanagement.interfaces.dto.AddOrganizationModelAtomTypeDTO;
import com.main.organizationandplatformmanagement.interfaces.dto.AddOrganizationModelAtomsDTO;
import com.main.organizationandplatformmanagement.interfaces.dto.AddOrganizationModelDTO;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "Organization", description = "组织架构")
@RestController
@RequestMapping("")
public class OrganizationFacade {
    @Resource
    private OrganizationService organizationService;

    @PostMapping("/addOrganization")
    public RespBody<Organization> addOrganization(@Validated @RequestBody AddOrganizationDTO addOrganizationDTO) {
        return organizationService.addOrganization(addOrganizationDTO);
    }

    @PostMapping("/addOrganizationModelAtomType")
    public RespBody<OrganizationModelAtomType> addOrganizationModelAtomType(@Validated @RequestBody AddOrganizationModelAtomTypeDTO addOrganizationModelAtomTypeDTO) {
        return organizationService.addOrganizationModelAtomType(addOrganizationModelAtomTypeDTO);
    }

    @PostMapping("/addOrganizationModelAtoms")
    public RespBody<OrganizationModelAtoms> addOrganizationModelAtoms(@Validated @RequestBody AddOrganizationModelAtomsDTO addOrganizationModelAtomsDTO) {
        return organizationService.addOrganizationModelAtoms(addOrganizationModelAtomsDTO);
    }

    @PostMapping("/addOrganizationModel")
    public RespBody<OrganizationModel> addOrganizationModel(@Validated @RequestBody AddOrganizationModelDTO addOrganizationModelDTO) {
        return organizationService.addOrganizationModel(addOrganizationModelDTO);
    }
    @PostMapping("/getOrganizationModelById")
    public RespBody<List<OrganizationModel>> getOrganizationModelById(@Validated @RequestBody Long id) {
        return organizationService.getOrganizationModelById(id);
    }
}
